Skip to content

Comments

Major overhaul of the type system to manage typed proof search with an easier-to-maintain and less invasive API#53

Open
jrosain wants to merge 11 commits intoGoelandProver:masterfrom
jrosain:update-type-system
Open

Major overhaul of the type system to manage typed proof search with an easier-to-maintain and less invasive API#53
jrosain wants to merge 11 commits intoGoelandProver:masterfrom
jrosain:update-type-system

Conversation

@jrosain
Copy link
Member

@jrosain jrosain commented Jul 27, 2025

Bug fix

Closes: #38

Description

I've totally removed the old typing system and reworked it in something new:

  • There is no more layering of types in the internal representation, we trust the elaboration between parsing terms and internal terms to handle this stuff. This is less confusing when working with types in the internal syntax.
  • Types are not embedded into terms / formulas anymore: only metavariables get their type. This makes the API of terms/formulas more easily maintainable as we don't need to worry about types.
  • The typing system itself has been simplified to make it more maintainable: we don't check well-formedness of contexts anymore as it's useless.
  • Moreover, there's only one global environment. This makes it easy to interpret a type statement: simply add the pair (name, type) to the global env using the only exposed function that does that.
  • The global environment can be queried with type instantiations, and lets the user do the error management in these types using option types.
  • Overall, the typing system yields better errors and has a way better debug environment using a high-level and a low-level debugger.
  • Added MixedSubstitution, which stores both term and type substitutions. Adapted the destructive proof search to make use of it. DMT is not fully supported yet, but I think the update is straightforward. Non-destructive search does not support mixed substitutions (as an aside, maybe we should cleanup the non destructive version, it doesn't work anyway so we could simply return errors saying this isn't implemented yet or simply remove the option to do non-destructive search).
  • Cleaned-up some old functions out of the proof search.
  • Disabled context printing of typed problems in Rocq/LambdaPi output as they were mostly useless anyway. I'm planning to fix it when taking care of Syntax error in Rocq output due to illegal character in skolem symbols / types #52

PR dependencies

Test-suite update

  • added basic TFF1 file to check that type metas are properly substituted in proofs test-suite/proofs/tf1_basic_thm.p
  • added basic TFF1 file to check that skolemized type variables are properly instantiated in proofs test-suite/proofs/tf1_basic_thm-2.p
  • added TFF1 file that should fail at typechecking that allowed me to find a bug in the generic parallel library and the function calls test-suite/bugs/bug_53-1.p
  • added elaboration tests test-suite/basic/test-typing-elab-n.p to check the ad-hoc polymorphism of defined arithmetic functions and the edge case of quotients

@jrosain jrosain requested a review from jcailler July 27, 2025 10:01
@github-actions github-actions bot added the needs:ci Needs a CI run before merging label Jul 27, 2025
@jrosain jrosain added kind:enhancement New feature or upgrade of a previous one kind:cleanup Refactoring or improvement of existing code part:proof-search The PR is about the proof-search algorithm part:typing The PR is about typed terms/the typing algorithm kind:fix The PR fixes a bug has:other-pr-dependency This PR cannot be merged before another PR (the maintainer should specify the dependency(ies)) part:unification About the unification process of Goéland request:ci Requests a CI run from the workflow labels Jul 27, 2025
@jrosain jrosain added this to the 1.2 milestone Jul 27, 2025
@github-actions github-actions bot removed the request:ci Requests a CI run from the workflow label Jul 27, 2025
@jrosain jrosain force-pushed the update-type-system branch from 2780a16 to cc89202 Compare July 27, 2025 10:14
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Jul 27, 2025
@github-actions github-actions bot removed request:ci Requests a CI run from the workflow needs:ci Needs a CI run before merging labels Jul 27, 2025
@jrosain jrosain force-pushed the update-type-system branch from cc89202 to f0c5429 Compare July 27, 2025 15:50
@github-actions github-actions bot added the needs:ci Needs a CI run before merging label Jul 27, 2025
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Jul 27, 2025
@github-actions github-actions bot removed the request:ci Requests a CI run from the workflow label Jul 27, 2025
@jrosain jrosain force-pushed the update-type-system branch from f0c5429 to c064455 Compare July 27, 2025 16:45
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Jul 27, 2025
@github-actions github-actions bot added needs:ci Needs a CI run before merging and removed request:ci Requests a CI run from the workflow needs:ci Needs a CI run before merging labels Jul 27, 2025
@jrosain jrosain force-pushed the update-type-system branch from ab5b778 to 917dfa1 Compare July 28, 2025 07:33
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Jul 28, 2025
@github-actions github-actions bot removed request:ci Requests a CI run from the workflow needs:ci Needs a CI run before merging labels Jul 28, 2025
@jrosain jrosain force-pushed the update-type-system branch from 917dfa1 to 02d53ef Compare August 26, 2025 08:29
@github-actions github-actions bot added the needs:ci Needs a CI run before merging label Aug 26, 2025
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Aug 26, 2025
@jrosain jrosain force-pushed the update-type-system branch from 02d53ef to 0ead997 Compare August 29, 2025 13:39
@jrosain jrosain added request:ci Requests a CI run from the workflow and removed request:ci Requests a CI run from the workflow labels Aug 29, 2025
@github-actions github-actions bot removed request:ci Requests a CI run from the workflow needs:ci Needs a CI run before merging labels Aug 29, 2025
@jrosain jrosain force-pushed the update-type-system branch from 0ead997 to 0c627a3 Compare February 7, 2026 16:30
@github-actions github-actions bot added the needs:ci Needs a CI run before merging label Feb 7, 2026
@jrosain jrosain added the request:ci Requests a CI run from the workflow label Feb 7, 2026
@github-actions github-actions bot removed request:ci Requests a CI run from the workflow needs:ci Needs a CI run before merging labels Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has:other-pr-dependency This PR cannot be merged before another PR (the maintainer should specify the dependency(ies)) kind:cleanup Refactoring or improvement of existing code kind:enhancement New feature or upgrade of a previous one kind:fix The PR fixes a bug part:proof-search The PR is about the proof-search algorithm part:typing The PR is about typed terms/the typing algorithm part:unification About the unification process of Goéland

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic: invalid memory address or nil pointer dereference on typing a TFF1 problem / TFF1 proof search is not handled

2 participants